import { parse } from "node-html-parser"

export type { HTMLElement } from "node-html-parser"

export const createDocument = (html: string): HTMLElement =>
	Object.assign(parse(html) as any, {
		createElement(tag: string): HTMLElement {
			return parse(`<${tag}></${tag}>`).firstChild as any
		},
	})
